<template>
    <div class="content">
        <el-dialog :visible.sync="modifyAllow.dialogFormVisible" title="确定要批量审核通过吗？" size="tiny" :before-close="handleClose" > 
            <div v-loading = loading>
                <el-form :model="form" label-width="80px">
                    <el-row :gutter="20">
                        <el-col :span="7">
                            <el-form-item label=""></el-form-item>
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="总计数量:">
                            {{modifyAllow.length}}个
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :gutter="20">
                        <el-col :span="7">
                            <el-form-item label=""></el-form-item>
                        </el-col>
                        <el-col :span="15">
                            <el-form-item label="总计金额:">
                            {{total | moneySwitch}}元
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            <footer>
              <el-button @click="handleClose">取消</el-button>
              <el-button @click="add" type="primary">确认</el-button>
            </footer>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import { count, batchCheck } from 'api/mentionManagement';
export default {
    name: 'mentionallow',
    props: {
        modifyAllow: {}
    },
    created() {
        this.count();
    },
    data() {
        return {
            loading: false,
            form: {},
            total: 0
        };
    },
    methods: {
        handleClose() {
            this.modifyAllow.dialogFormVisible = false;
        },

        add() {
      // 确认审批
            this.loading = true;
            batchCheck(this.modifyAllow.state, this.modifyAllow.pid)
        .then(res => {
            this.loading = false;
            this.$message({
                type: 'success',
                message: res.data.errorMsg
            });
            this.$emit('sortAllow', '确认');
            this.modifyAllow.dialogFormVisible = false;
        })
        .catch(error => {
            this.loading = false;
        });
        },
        count() {
      // 请求总金额
            this.loading = true;
            count(this.modifyAllow.pid)
        .then(res => {
            this.total = res.data.content;
            this.loading = false;
        })
        .catch(error => {
            this.loading = false;
        });
        }
    }
};
</script>
<style lang="scss" scoped>
section,
footer {
  text-align: center;
}
.title {
  text-align: left;
  color: #999;
}
section {
  padding-bottom: 50px;
  el-button {
    margin-right: 20px;
  }
}
</style>
